home *** CD-ROM | disk | FTP | other *** search
- #ifdef LATTICE
- typedef ULONG(*FPTR) ();
-
- #endif
- #ifdef AZTEC_C
- typedef VOID(*FPTR) ();
-
- #endif
-
- IMPORT struct IntuitionBase *IntuitionBase;
-
- #define LVOActivateWindow -0x01c2L
-
- VOID __stdargs __saveds myActivateWindow( void);
-
- LONG oldActivateWindow;
-
- STATIC WORD patched = 0;
-
- VOID SafePatch( void)
- {
- if (!patched)
- {
- Forbid(); /* I don't expect interrupts to do much intuition */
- oldActivateWindow = (LONG) SetFunction((struct Library *)IntuitionBase, LVOActivateWindow, (FPTR) myActivateWindow);
- Permit();
- patched = 1;
- }
- }
-
- VOID SafeRestore( void)
- {
- if (patched)
- {
- Forbid();
- (VOID) SetFunction((struct Library *)IntuitionBase, LVOActivateWindow, (FPTR) oldActivateWindow);
- Permit();
- patched = 0;
- }
- }
-